package com.societyGames.catExercises
{
import com.societyGames.codeExercise.CodeExercise;

public class CatCodeExercise extends CodeExercise
{
  public var catCount:int = 4;
  public var batCount:int = 0;
  public var hatMultiplier:int = 0;
  public var mittenMultiplier:int = 0;

  protected var _catSimulation:CatSimulation;

  public function CatCodeExercise()
  {
    this._catSimulation = new CatSimulation(this._actionQueue);
    this.addChild(this._catSimulation.render);
  }

  public function get catSimulation():CatSimulation
  {
    return this._catSimulation;
  }

  //ICodeExercise-->
  public override function initialize():void
  {
    this._catSimulation.initialize(catCount, batCount);
  }

  protected override function evaluateWithExceptionsHandled():void
  {
    if (this._catSimulation.hatCount == this._catSimulation.catCount * this.hatMultiplier &&
            this._catSimulation.mittenCount == this._catSimulation.catCount * this.mittenMultiplier)
    {
      reportSuccess();
    }
    else
    {
      reportFailure();
    }
  }
  //<--ICodeExercise
}
}